package cn.bugstack.springframework.beans.factory.support;

import cn.bugstack.springframework.beans.factory.config.SingletonBeanRegistry;

import java.util.HashMap;
import java.util.Map;

/**
 * @author ouyangzhao
 */
public class DefaultSingletonBeanRegistry implements SingletonBeanRegistry {

    /**
     * bean的注册表
     */
    Map<String, Object> beanMap = new HashMap<String, Object>();


    @Override
    public Object getSingleton(String beanName) {
        return beanMap.get(beanName);
    }

    public void addSingleton(String beanName, Object bean) {
        beanMap.put(beanName, bean);
    }
}
